//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#include "TMainForm.h"
#include "TAdviceForm.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TAdviceForm *AdviceForm;
//---------------------------------------------------------------------------
__fastcall TAdviceForm::TAdviceForm(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TAdviceForm::FormShow(TObject *Sender)
{
  AdviceMemo->Text = LoadMemo->Lines->Strings[MainForm->LastAdvice];
  ShowCB->Checked = MainForm->ShowAdvices;
}
//---------------------------------------------------------------------------
void __fastcall TAdviceForm::CloseBtnClick(TObject *Sender)
{
  Hide();
  if (MainForm->FirstTime)
    MainForm->SkaicExecute(Sender);
}
//---------------------------------------------------------------------------
void __fastcall TAdviceForm::NextBtnClick(TObject *Sender)
{
  if (MainForm->LastAdvice >= LoadMemo->Lines->Count-1)
    MainForm->LastAdvice = 1;
  else MainForm->LastAdvice++;
  AdviceMemo->Text = LoadMemo->Lines->Strings[MainForm->LastAdvice];
}
//---------------------------------------------------------------------------
void __fastcall TAdviceForm::FormCreate(TObject *Sender)                                        
{
  LoadMemo->Lines->LoadFromFile(MainForm->Path + "Globals/Patarimai.txt");
}
//---------------------------------------------------------------------------
void __fastcall TAdviceForm::ShowCBClick(TObject *Sender)
{
  MainForm->ShowAdvices = ShowCB->Checked;
}
//---------------------------------------------------------------------------

